import React from 'react'
import { Form,Table, Icon, Tag, Modal, Steps, Button, message,Input,Row,Col,Select,DatePicker,InputNumber,Dropdown,Menu,Badge } from 'antd'
import { DropOption } from 'components'
import styles from './List.less'
import moment from "moment";
const Step = Steps.Step;
const confirm = Modal.confirm
const FormItem = Form.Item;
const Option = Select.Option;


class ModalSelect extends React.Component {
 constructor(props) {
    super(props);
    this.state = {
      current: 0,
      value:'',
      bottons:'查看'
    };
    const { current } = this.props.pagination1;
    this.currentPage = current;
    this.newPage = current;
  }
   async pageChange(pagination) {
    await this.props.onPageChange(pagination);
    this.newPage = pagination.current;
  }

  edit  = (record, e,text) => {
  	const {showDetail,onDeleteItem,onComponent,onEidt,onSearch} = this.props
  	if(e == 1){
//		alert("1")
		showDetail(record.id)
  	}else if(e == 2){
  		window.location = "/file/newfile?" + record.id
  	}else if(e == 3){
  		confirm({
        title: '您确定要删除这条记录吗?',
        onOk () {
          onDeleteItem(record.id)
        }
      })
  	}else if(e == 4){
  		confirm({
        title: '您确定要归档这条记录吗?',
        onOk () {
        		if(record.state == 0){
        			onComponent(record.id,1)
        		}
        		if(record.state == 1){
        			onComponent(record.id,2)
        		}
          
        }
      })
  	}else if(e == 5){
  		onEidt(record.id,record.organizationId)
  	}
  } 

	render(){
		const { loading, list1, pagination1, onPageChange, list2,showDetail,list } = this.props;
		const datas = [{
		  key: '1',
		  number: '胡彦斌',
		  title:'测试',
		  type: '测试的',
		  state:1,
		  department:'部门1',
		  person:'管理1',
		  time:'2018-03-02',
		  title: '西湖区湖底公园1号'
		}];
		const columns = [
			{
				title: "申请人",
				dataIndex: "applyName",
				key: "applyName",
			},{
				title:"身份证号码",
				dataIndex:"idcard",
				key:"idcard",
			},{
				title:"公证事项",
				dataIndex:"notarialMatters",
				key:"notarialMatters",
			},{
				title:"公证号码",
				dataIndex:"notaryNumber",
				key:"notaryNumber"
			},{
				title:"承办人",
				dataIndex:"contractorUserName",
				key:"contractorUserName",
			},{
				title:"建档人",
				dataIndex:"createdUserName",
				key:"createdUserName",
			},{
				title: "收件日期",
				dataIndex: "createdTime",
				key: "createdTime",
				render: (text, record) => {
					return (
						<p>
							{
								moment(record.createdTime).format("YYYY-MM-DD")
							}
						</p>
					)
				}
			},{
				title: "公证日期",
				dataIndex: "notarizationAt",
				key: "notarizationAt",
				render: (text, record) => {
					return (
						<p>
							{
								moment(record.notarizationAt).format("YYYY-MM-DD")
							}
						</p>
					)
				}
			}
			// {
			// 	title: "申请提交日期",
			// 	dataIndex: "applicationCreatedTime",
			// 	key: "applicationCreatedTime",
			// 	render: (text, record) => {
			// 		return (
			// 			<p>
			// 				{
			// 					moment(record.applicationCreatedTime).format("YYYY-MM-DD")
			// 				}
			// 			</p>
			// 		)
			// 	}
			// },
			// {
			// 	title: "状态",
			// 	dataIndex: "applicationState",
			// 	key: "applicationState",
			// 	render: (text, record) => {
			// 		return (
			// 			<div>
			// 				{record.applicationState == 0 ?
			// 					<div><Badge status="processing" /><span>待审核</span></div> :
			// 					record.applicationState == 1 ?
			// 						<div><Badge status="success" /><span>通过</span></div> :
			// 						record.applicationState == 2 ?
			// 							<div><Badge status="error" /><span>拒绝</span></div> :
			// 							<div><Badge status="success" /><span>已通过</span></div>
			// 				}
			// 			</div>
			// 		)
			// 	}
			// },

			// 暂时不做操作
	//       ,{
	//         title: '操作',
	//         key: 'operation',
	//         render: (text, record) => {
	//           return (
	//           	<div>
	//           		<span onClick={this.edit.bind(null,record,1)} style={{marginRight:5}}><a href="#">查看</a></span>
	//           		<span onClick={this.edit.bind(null,record,2)} style={{marginRight:5}}><a href="#">修改</a></span>
	//           		<span onClick={this.edit.bind(null,record,3)} style={{marginRight:5}}><a href="#">删除</a></span>
	//           		{record.state =="0"?
	//           		<span onClick={this.edit.bind(null,record,4)} style={{marginRight:5}}><a href="#">归档</a></span>:
	//           		record.state =="1"?
	//           		<span onClick={this.edit.bind(null,record,4)} style={{marginRight:5}}><a href="#">历史归档</a></span>:
	//           		""
	//           		}
	//           		<span onClick={this.edit.bind(null,record,5)} style={{marginRight:5}}><a href="#">移交</a></span>
	//           	</div>
	//           )
    //     }
    //   }
	      
	    ];

		return (
	     <div>
	        <Table
	          columns={columns}
	          dataSource={list}
	          loading={loading}
	          onChange={this.pageChange.bind(this)}
	          pagination={pagination1}
			  rowKey={record => record.endAt}
	        />
	
	      </div>
	  	)
}
  

}

export default Form.create()(ModalSelect)
